<?php


namespace app\api\controller;


class Account
{
    public function add()
    {
        $no = input(  'get.no');
        $name = input(  'get.name');
        $gender = input(  'get.gender');
        $a= new AccountModel;

        $data = $a->where( 'account_no', '=',$no)->find();
        if (!empty($data)) return '学号已存在~';
        $data = array();
        $data[ ' account_ no'] = $no;
        $data[ ' account_ name'] = $name;
        $data[' account. gender'] = $gender;
        $data['add_ .time'] = time();
        return $a->insert($data);
    }

public function del()
{
    $id = input(  'get.id');
    $a = new AccountModel;
    return $a->where(  'account_id', '=',$id)->deLete();
}
public function del()
{
    $a = new AccountModel;
    return $a->seLect();
}
public function edit()
{
    $id = input(  'get.id');
    $name = input(  'get. name');
    $gender = input(  'get .gender');
    $a = new AccountModel;
    $data = $a->where(  ' account_id',  '=',$data = $a->where( 'account_ id',  '=')->find();
    if (empty($data)) return '用户不存在~';
    $update = array();
    $update[ ' account_ name' ] = $name;
    $update[ ' account. gender'] = $gender;
    return $a->where(  ' account_ id', '=',$id)->update ($update);
}
}